import Vue from './lib/index.js'

const vm = new Vue({
  el: '#app',
  data: {
    msg: 'haha',
    person: {
      name: {
        nic: 'mike'
      },
      size: 52,
    },
    dom: {
      html: '<span style="font-size: 18px; color: red;">我是v-html渲染的</span>'
    }
  },
  methods: {
    changeHtml (size, color) {
      console.log(this)
      console.log(size, color)
      const fontSize = size || 22
      const fontColor = color || 'blue'
      this.dom.html = `<span style="font-size: ${fontSize}px; color: ${fontColor};">我是v-html渲染的</span>`
    }
  }
})

const changeMsg = () => {
  vm.msg = 'xixi'
}

document.querySelector('#msg').addEventListener('click', () => {
  changeMsg()
})

document.querySelector('#name').addEventListener('click', () => {
  vm.person.name.nic = 'tom'
})
